package tarantula.util;

import java.io.File;
import java.io.IOException;
import java.util.List;

import junit.framework.TestCase;

public class TestFileUtils extends TestCase {
	
	public void testCreateNonExistFile() throws IOException {
		String content = "hello";
		String dir = "." + Globals.fileSep + "testdata"
	        + Globals.fileSep + "notexist";
		String nonExistDir =  dir + Globals.fileSep + "see.txt";
		FileUtils.writeToFileNoExp(content, nonExistDir);
		List<String> filecontent = FileUtils.readWhole(nonExistDir);
		assertTrue(filecontent.size() == 1);
		assertTrue(filecontent.get(0).equals(content));
		assertTrue(new File(nonExistDir).delete());
		assertTrue(new File(dir).delete());
	}
}
